<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        class Person {
            static myname = "person类的名字"
            static mymethod = function () {
                console.log("mymethod")
            }
            constructor(name, age) {
                this.name = name
                this.age = age
            }
            say() {
                console.log(this.name, this.age)
            }
        }
        //等价于static写法，不用new，直接通过类名.来访问
        // Person.myname = "person类的名字"
        // Person.mymethod = function () {
        //     console.log("mymethod")
        // }
        let obj = new Person("twj", 100)
        console.log(Person.myname)
        Person.mymethod()
    </script>
</body>

</html>